package cn.com.thingo.hyintelligent.di.module;


import javax.inject.Singleton;

import cn.com.thingo.hyintelligent.app.App;
import cn.com.thingo.hyintelligent.model.DataManager;
import cn.com.thingo.hyintelligent.model.http.HttpHelper;
import cn.com.thingo.hyintelligent.model.http.RetrofitHelper;
import cn.com.thingo.hyintelligent.model.prefs.ImplPreferencesHelper;
import cn.com.thingo.hyintelligent.model.prefs.PreferencesHelper;
import dagger.Module;
import dagger.Provides;

/**
 * Created by Administrator on 2017/10/9.
 */

@Module
public class AppModule {
    private final App application;

    public AppModule(App application) {
        this.application = application;
    }

    @Provides
    @Singleton
    App provideApplicationContext() {
        return application;
    }

    @Provides
    @Singleton
    HttpHelper provideHttpHelper(RetrofitHelper retrofitHelper) {
        return retrofitHelper;
    }

    @Provides
    @Singleton
    PreferencesHelper providePreferencesHelper(ImplPreferencesHelper implPreferencesHelper) {
        return implPreferencesHelper;
    }

    @Provides
    @Singleton
    DataManager provideDataManager(HttpHelper httpHelper, PreferencesHelper preferencesHelper) {
        return new DataManager(httpHelper, preferencesHelper);
    }
}
